<?php
    if (!empty($daiShenPinTiXingData) && $daiShenPinTiXingData['data']['count']>0){
        $num=1;
        $daiShenPinTiXingCount = $daiShenPinTiXingData['data']['count'];
        foreach ($daiShenPinTiXingData['data']['res'] as $k => $v) {
        
            $message_val = !empty($v['message_val'])?json_decode($v['message_val'],true):'';
            $pack_name = $message_val['pack_name'];
            $applicant = $message_val['applicant'];
            $application = $message_val['application'];
            $applicationReason = $message_val['applicationReason'];

            $package_project_id = !empty($v['package_project_id'])?$v['package_project_id']:0;
            $message_group = !empty($v['message_group'])?$v['message_group']:0;

            $message_state = !empty($v['message_state'])?$v['message_state']:2;  //2未阅读
            $message_user_group_id = !empty($v['message_user_group_id'])?$v['message_user_group_id']:2;  //2未阅读
            $sender = !empty($v['sender'])?$v['sender']:0;  //发件人
            $user_id = !empty($v['user_id'])?$v['user_id']:0;  //收件人
            $is_package = !empty($v['is_package'])?$v['is_package']:1; //是否为资产包

            //--资产包/单项目详情页链接---权限控制
            $isView = \backend\controllers\DtActionFilter::checkPackage('package_view',$user_id);
            if (!empty($v['is_package'])&&$v['is_package']==1) {
                $titleAlt = "资产包名称";
            }else{
                $titleAlt = "项目名称";
            }
            if ($isView){
                if (!empty($v['is_package'])&&$v['is_package']==1){
                    $packageInfoUrl = '/package/detail-info?packageid='.$package_project_id;
                }else{
                    $projectModel = (new \yii\db\Query())->from('project')->where(['=','id',$package_project_id])->one();
                    if (!empty($projectModel)){
                        $packageToId = $projectModel['package_id'];
                    $packageInfoUrl = '/project/getinfodata?package_id='.$packageToId.'&project_id='.$package_project_id;
                    }else{
                        $packageInfoUrl = "#";
                    }
                }
            }else{
                $packageInfoUrl = "#";
            }
            //url 分 访问审批/立项审批
            if ($application == "访问审批"){
                $packageUrl = '/audit-management/access?shenPiGroup=5&user_id='.$sender.'&accessKey='.$pack_name.'&package_project_id='.$package_project_id.'&message_state='.$message_state.'&message_user_group_id='.$message_user_group_id.'&message_group='.$message_group.'&sender='.$user_id.'&is_package='.$is_package.'&is_fangwen=1';
            }else{
                $packageUrl = '/audit-management?shenPiGroup=1&user_id='.$sender.'&keyWords='.$pack_name.'&keyWords='.$pack_name.'&package_project_id='.$package_project_id.'&message_state='.$message_state.'&message_user_group_id='.$message_user_group_id.'&message_group='.$message_group.'&sender='.$user_id.'&is_package='.$is_package.'&is_fangwen=2';
            }
            $upTime = !empty($v['message_start_time'])?$v['message_start_time']:'无时间';
            if ($num<=10){
                $num++;
            echo <<<DAISHENPINTIXING
                    <div class="remand-list dsptx">
                        <div class="remand-list-nav clearfix">
                        <span class="pull-left nav-l">待审批提醒</span>
                        <div class="pull-right qcl">
                            <img src="/image/officeHall/dcl.png" class="pull-left">
                            <a href="$packageUrl"><span class="pull-left">去处理</span></a>
                        </div>
                        </div>
                        <div class="remand-list-content clearfix">
                            <span>$titleAlt ： <font><a href="$packageInfoUrl">$pack_name</a></font></span>
                            <span>申请人： <font>$applicant</font></span>
                            <span>申请事项： <font>$application</font></span></br>
                            <span class="">申请理由：  <font>$applicationReason</font></span>
                            <span class="pull-right">$upTime</span>
                        </div>
                    </div>
DAISHENPINTIXING;
            }
        }
    }
?>


